package waitNotifyBlockingQueue;

import java.util.concurrent.ArrayBlockingQueue;

public class Cook extends Thread{
    public ArrayBlockingQueue queue;

    public Cook(ArrayBlockingQueue queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        while (true){
            try {
                if(Foodie.full > 0){
                queue.put("食物");
                System.out.println("厨师放了一碗饭");
                }else {
                    break;
                }
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
